import axios from "axios";
import service from "@/config/index";

const URLS = {
  INSERT: `${service.serviceBasic}/carrier/invite`,
  UPDATE_NICK_NAME: `${service.serviceTenant}/alias/`,
  DISABLE_USER: `/tenant/user/disable`,
};
export default {
  insert (params) {
    return axios.post(URLS.INSERT, params);
  },
  updateNickName (alias) {
    return axios.put(`${URLS.UPDATE_NICK_NAME}${alias}`);
  },
  task () {
    return axios.get(`${service.serviceTenant}/task`);
  },
  getTenantByCode (code) {
    return axios.get(`${service.serviceTenant}/code/${code}`);
  },
  enableUser (userId) {
    return axios.put(`${service.serviceTenant}/user/enable/${userId}`, {});
  },
  disableUser (userId) {
    return axios.put(URLS.DISABLE_USER + "/" + userId, {});
  },
  getTenantInfo () {
    return axios.get(`${service.serviceTenant}`);
  },
  getTenantBigData () {
    return axios.get(`${service.serviceTenant}/bigData`);
  },
  userEditPassword (userId, params) {
    return axios.put(`${service.serviceTenant}/user/password/${userId}`, params)
  },
  // 手机验证码修改密码
  passwordSMS (params) {
    return axios.put(`${service.serviceTenant}/password`, params);
  },
  // 修改验证码
  passwordCode (params) {
    return axios.post(`${service.serviceTenant}/password/code`, params);
  },
  // 管理员：发送邮箱验证码
  mailCode (params) {
    return axios.post(`${service.serviceTenant}/mail/code`, params);
  },
  // 管理员：绑定邮箱
  bindEmail (params) {
    return axios.post(`${service.serviceTenant}/mail/bind`, params);
  },
  // 登录页- 邮箱验证码
  forgetPasswordCode (params) {
    return axios.post(`${service.serviceTenant}/mail/password/code`, params);
  },
  // 登录页-邮箱更改密码
  forgetPassword (params) {
    return axios.post(`${service.serviceTenant}/mail/password`, params);
  },
  // 用户管理 -新增
  addUser (params) {
    return axios.post(`${service.serviceTenant}/user`, params);
  },
  updateUser (params, userKeyId) {
    return axios.put(`${service.serviceTenant}/user/${userKeyId}`, params);
  },
};
